<template>

姓名：<input type="text" v-model="Sousuo.Name">

创建时间:<input type="date" v-model="Sousuo.Ctime">

<button @click="daochu">导出</button>
<button @click="xianshi1">搜索</button>

<table class="table table-bordered">


 <thead>
    <tr>
        <th>房号id</th>
        <th>房号姓名</th>
        <th>房号创建时间</th>
    </tr>
 </thead>

 <tbody v-for="item in xianshi">

    <tr>
        <th>{{ item.hid}}</th>
        <th>{{ item.hname }}</th>
        <th>{{ item.ctime }}</th>
    </tr>
 </tbody>



</table>
 

<button @click="Fanye('S')">首页</button>
<button @click="Fanye('E')">上一页</button>
<button @click="Fanye('F')">下一页</button>
<button @click="Fanye('M')">尾页</button>




</template>


<script setup lang="ts">




const Fanye =(chool:string)=>{

   
    switch(chool){

            case 'S':
                FenYe.value.s=1
                break;
            case 'E':

            if(FenYe.value.s<=1)
            {
                alert('不能小于1')
                return ;
            }
            FenYe.value.s-=1;
            break;

            case 'F':
                if(FenYe.value.s>=FenYe.value.Zy)
            {
                alert('不能大于总页码')
                return ;
            }
            FenYe.value.s+=1
            break;

            case 'M':
                    FenYe.value.s=FenYe.value.Zy
            break;


    

    }


               xianshi1();

}


import axios from 'axios';
import {onMounted, ref} from 'vue'
const xianshi=ref([{
    "hid": 0,
      "hname": "string",
      "ctime": "2024-12-26T01:39:24.786Z"

}])


const Sousuo=ref({
    Name:"",
    Ctime:null,



})

const FenYe=ref({
s:1,
m:3,
count:0,
Zy:0,



})


onMounted(()=>{
    TiaoZhuan();
    xianshi1();

})

const xianshi1=()=>{


    axios.get('https://localhost:7055/api/FangHao/ShowFang',{params:{

        s:FenYe.value.s,
        m:FenYe.value.m,
        Name:Sousuo.value.Name,
        Ctime:Sousuo.value.Ctime,

    }}).then(res=>{
        xianshi.value=res.data.data

        FenYe.value.count=res.data.count,
        FenYe.value.Zy=res.data.zy

    })

}


const  daochu=()=>{


axios.post('https://localhost:7055/api/FangHao/UpFile?path=C%3A%5CUsers%5C31718%5CDesktop%5C234.xlsx',).then(res=>{

    if(res.data>0)
{
    alert('导出成功')
}

})

}



import { useCounterStore } from '@/stores/use'; 
import router from '@/router';
const vv=useCounterStore();

const TiaoZhuan=()=>{

if(vv.cc!="管理员")
{
    router.push('/')
}


}

</script>